﻿/// <reference path="TsLinq.d.ts" />
//
//  Default comparer for strings and numbers
//
var DefaultComparer = (function () {
    function DefaultComparer() {
    }
    //
    //  Returns a value which indicates wherever item1 is bigger, smaller or equal with item2. If -1 is returned, item1 is smaller, if 0 is returned, both are equal and if 1 is returned, item1 is bigger than item2.
    //
    DefaultComparer.prototype.compare = function (item1, item2) {
        if (item1 < item2)
            return -1;
        if (item1 == item2)
            return 0;
        return 1;
    };
    return DefaultComparer;
})();

//
//  This comparer gets the JSON string of the objects to compare and then compares this strings.
//
var JsonStringComparer = (function () {
    function JsonStringComparer() {
    }
    //
    //  Returns a value which indicates wherever item1 is bigger, smaller or equal with item2. If -1 is returned, item1 is smaller, if 0 is returned, both are equal and if 1 is returned, item1 is bigger than item2.
    //
    JsonStringComparer.prototype.compare = function (item1, item2) {
        var i1 = JSON.stringify(item1);
        var i2 = JSON.stringify(item2);
        if (i1 < i2)
            return -1;
        if (i1 == i2)
            return 0;
        return 1;
    };
    return JsonStringComparer;
})();
